package com.geekcoding.geekoj.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.geekcoding.geekoj.entity.Subject;
import com.geekcoding.geekoj.mapper.SubjectMapper;
import org.springframework.stereotype.Repository;

import java.sql.Wrapper;

@Repository
public class SubjectRepository extends BaseRepository<Subject, Subject, SubjectMapper> {
    @Override
    public Subject convert(Subject entity) {
        return entity;
    }

    public Subject queryByCode(String subjectCode) {
        return baseMapper.selectOne(Wrappers.<Subject>lambdaQuery().eq(Subject::getCode, subjectCode));
    }
}
